﻿@{
}
<section class="container-fluid m15_t">
    <div class="data-wrap case">
        <form class="form-inline" id="formSearch" method="get" action="/iqs/exportExcel">
            <div class="data-tool clearfix">

                <div class="pull-left form-inline ">
                    <a class="btn btn-default btn-sm add" data-title="导出" onclick="return exportExcel();"><span class="glyphicon glyphicon-plus"></span> 导出</a>
                </div>
                <div class="pull-right">
                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">开始时间：</label>
                        <input class="form-control wd135" name="startTime" type="text" value="@(ViewBag.StartTime)" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" autocomplete="off" />
                        <label class="input-group-addon m5_l">结束时间：</label>
                        <input class="form-control wd135" name="endTime" type="text" value="@(ViewBag.EndTime)" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" autocomplete="off" />
                        <label class="input-group-addon m5_l">厂号：</label>
                        <input class="form-control wd100" name="plntNum" type="text" autocomplete="off">
                        <label class="input-group-addon m5_l">料号：</label>
                        <input class="form-control wd100" name="partNum" type="text" autocomplete="off">
                    </div>
                    <button type="button" class="btn btn-default btn-sm active" id="btnSearch"><span class="glyphicon glyphicon-search"></span> 搜索</button>
                    <button type="button" class="btn btn-default m5_l" id="AdvSearchBtn">高级搜索</button>
                </div>

            </div>
            <!--AdvSearch start-->
            <div class="AdvSearch">
                <div class="AdvSearchcom collapse">
                    <table>
                        <tbody>
                            <tr>
                                <td width="20%">员工号：</td>
                                <td width="30%" class="p0_rl">
                                    <input class="form-control w150" name="staffNum" type="text" autocomplete="off">
                                </td>
                                <td width="20%">拆板人：</td>
                                <td width="30%" class="p0_rl">
                                    <input class="form-control w150" name="watchmanBy" type="text" autocomplete="off">
                                </td>
                            </tr>
                            <tr>
                                <td width="20%">机器编码：</td>
                                <td width="38%" class="p0_rl">
                                    <input class="form-control w150" name="equipmentCode" type="text" autocomplete="off">
                                </td>
                                <td width="20%">批号：</td>
                                <td width="30%" class="p0_rl">
                                    <input class="form-control w150" name="lotBatch" type="text" autocomplete="off">
                                </td>
                            </tr>
                            <tr>
                                <td width="20%">不显示：</td>
                                <td width="38%" class="p0_rl">
                                    <span style="margin-top:20px;"><input class="form-control m10_t" name="deleteStatus" type="checkbox" autocomplete="off"></span>
                                </td>
                                <td width="20%"></td>
                                <td width="30%" class="p0_rl">
                                    
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <div class="AdvSearchfooter t_c">
                        <button class="btn btn-default" type="button" id="btnAdvSearch">立即搜索</button>
                        <button class="btn btn-default m10_l" type="button" id="btnAdvCancel">取消</button>
                    </div>
                </div>
            </div>
        </form>
        <!--AdvSearch end-->
        <div class="paging">
        </div>
        <table class="layui-hide" id="test" lay-filter="test"></table>
    </div>
</section>
@section footerScript{
    <script src="/lib/date/wdatepicker.js"></script>
    <script type="text/html" id="optDelete">
        <a class="layui-btn layui-btn-xs" lay-event="del">删除</a>
    </script>
    <script type="text/html" id="optStaffNum">
        <a class="layui-btn layui-btn-xs" lay-event="edit">修改</a>
    </script>
    
    <script type="text/javascript">
        $(function () {
            //Topro.UI.DataAutoHeight();
            //点击高级搜索
            $("#AdvSearchBtn").click(function () {
                if ($(".AdvSearchcom").hasClass("collapse")) {
                    $(".AdvSearchcom").removeClass("collapse");
                } else {
                    $(".AdvSearchcom").addClass("collapse");
                }
            });
            //搜索
            $(".AdvSearchcom").find("button[id='btnAdvSearch']").click(function () {

                doSearch();

                $(".AdvSearchcom").addClass("collapse");
            });
            //取消
            $(".AdvSearchcom").find("button[id='btnAdvCancel']").click(function () {
                $(".AdvSearchcom").addClass("collapse");
            });
        });

        function Tip_success(word) {
            Topro.UI.Tip_success(word);
        }

        function exportExcel() {
            $("#formSearch").submit();
        }

        //修改
        function edit(id) {
            Topro.UI.DialogOpen($(obj).data("href"), {
                title: $(obj).data("title"),
                width: $(obj).data("width"),
                height: $(obj).data("height")
            });
        }

        var table;

        function doSearch() {

            var where = $("#formSearch").serializeJSON()

            table.reload('test', {
                url: '/iqs/IQSQuery',
                where: where
            });
        }

        $("#btnSearch").click(function () {
            doSearch();
        });

        layui.use(['jquery', 'table'], function () {

            table = layui.table;

            Topro.UI.Render(table, {
                elem: '#test',
                height: 'full-90',
                page: true,
                url: '/iqs/IQSQuery/',
                totalRow: true,
                limit: 50,
                cols: [[
                    { field: 'id', width: 75, title: '编号' },
                    {
                        field: 'id',
                        width: 70,
                        title: '修改',
                        templet: function (row) {
                            return '<a class="layui-btn layui-btn-xs" data-modal="/IQS/AddOrEdit?id=' + row.id + '" data-title="修改" data-width="452" data-height="200" lay-event="edit">修改</a>';
                        }
                    },
                    {
                        field: 'status',
                        width: 100,
                        title: '删除',
                        templet: function (row) {
                            if (row.deleteStatus === 1) {
                                return '已删除';
                            } else {
                                return '<a class="layui-btn layui-btn-xs" lay-event="del">删除</a>';
                            }
                        },
                        align: 'center',
                    },
                    { field: 'machineCode', width: 90, title: '配置编码' },
                    { field: 'plntNum', width: 80, title: '厂号' },
                    {
                        field: 'staffNum',
                        width: 90,
                        title: '员工号',
                        templet: function (row) {
                            return row.staffNum;
                        }
                    },
                    {
                        field: 'shiftNumString',
                        width: 60,
                        title: '班次',
                        align: 'center',
                    },
                    { field: 'equipmentCode', width: 100, title: '设备编码', align: 'center' },
                    { field: 'lotBatch', width: 130, title: '批号' },
                    { field: 'partNum', width: 100, title: '料号' },
                    { field: 'heapNumber', width: 100, title: '叠合次数号', align: 'center' },
                    { field: 'materialType', width: 90, title: '材料类型' },
                    { field: 'travellerDate', width: 170, title: '流程卡时间' },
                    { field: 'pressProgram', width: 120, title: '压合程式' },
                    { field: 'cuFoilNum', width: 100, title: '铜箔编号' },
                    { field: 'cuFoilBatchNum', width: 250, title: '铜箔批号' },
                    { field: 'cuFoilExpire', width: 120, title: '铜箔有效期' },
                    { field: 'ppTypeNumber', width: 140, title: '半固化片种类数', align: 'center' },
                    { field: 'ppNumber', width: 140, title: '半固化片数量', align: 'center' },
                    { field: 'materialDate', width: 170, title: '材料时间', align: 'center' },
                    {
                        field: 'postponedMaterialType1_1',
                        width: 120,
                        title: '零包OR整包',
                        templet: function (row) {
                            var result = "";

                            if (row.postponedMaterialType1_1 == 10) {
                                result = "整包"
                            } else if (row.postponedMaterialType1_1 == 20) {
                                result = "零包"
                            }

                            return result;
                        },
                        align: 'center'
                    },
                    { field: 'packageNum1_1', width: 200, title: '包号1_1' },
                    { field: 'ppPcfPartNum1_1', width: 140, title: '料号1_1' },
                    { field: 'ppPcfBatchNum1_1', width: 140, title: '批号1_1' },
                    { field: 'ppPcfExpire1_1', width: 140, title: '有效期1_1' },
                    {
                        field: 'postponedMaterial1_1',
                        width: 140,
                        title: '延期材料1_1',
                        templet: function (row) {
                            var result = "";

                            if (row.postponedMaterial1_1 == 10) {
                                result = "是"
                            } else if (row.postponedMaterial1_1 == 20) {
                                result = "否"
                            }

                            return result;
                        },
                        align: 'center'
                    },

                    {
                        field: 'postponedMaterialType1_2',
                        width: 120,
                        title: '零包OR整包',
                        templet: function (row) {
                            var result = "";

                            if (row.postponedMaterialType1_2 == 10) {
                                result = "整包"
                            } else if (row.postponedMaterialType1_2 == 20) {
                                result = "零包"
                            }

                            return result;
                        },
                        align: 'center'
                    },
                    { field: 'packageNum1_2', width: 200, title: '包号1_2' },
                    { field: 'ppPcfPartNum1_2', width: 140, title: '料号1_2' },
                    { field: 'ppPcfBatchNum1_2', width: 140, title: '批号1_2' },
                    { field: 'ppPcfExpire1_2', width: 140, title: '有效期1_2' },

                    {
                        field: 'postponedMaterial1_2',
                        width: 140,
                        title: '延期材料1_2',
                        templet: function (row) {
                            var result = "";

                            if (row.postponedMaterial1_2 == 10) {
                                result = "是"
                            } else if (row.postponedMaterial1_2 == 20) {
                                result = "否"
                            }

                            return result;
                        },
                        align: 'center'
                    },

                    {
                        field: 'postponedMaterialType2_1',
                        width: 140,
                        title: '零包OR整包',
                        templet: function (row) {
                            var result = "";

                            if (row.postponedMaterialType2_1 == 10) {
                                result = "整包"
                            } else if (row.postponedMaterialType2_1 == 20) {
                                result = "零包"
                            }

                            return result;
                        },
                        align: 'center'
                    },

                    { field: 'packageNum2_1', width: 200, title: '包号2_1' },
                    { field: 'ppPcfPartNum2_1', width: 140, title: '料号2_1' },
                    { field: 'ppPcfBatchNum2_1', width: 140, title: '批号2_1' },
                    { field: 'ppPcfExpire2_1', width: 140, title: '有效期2_1' },

                    {
                        field: 'postponedMaterial2_1',
                        width: 140,
                        title: '延期材料2_1',
                        templet: function (row) {
                            var result = "";

                            if (row.postponedMaterial2_1 == 10) {
                                result = "是"
                            } else if (row.postponedMaterial2_1 == 20) {
                                result = "否"
                            }

                            return result;
                        },
                        align: 'center'
                    },

                    {
                        field: 'postponedMaterialType2_2',
                        width: 140,
                        title: '零包OR整包',
                        templet: function (row) {
                            var result = "";

                            if (row.postponedMaterialType2_2 == 10) {
                                result = "整包"
                            } else if (row.postponedMaterialType2_2 == 20) {
                                result = "零包"
                            }

                            return result;
                        },
                        align: 'center'
                    },
                    { field: 'packageNum2_2', width: 200, title: '包号2_2' },
                    { field: 'ppPcfPartNum2_2', width: 140, title: '料号2_2' },
                    { field: 'ppPcfBatchNum2_2', width: 140, title: '批号2_2' },
                    { field: 'ppPcfExpire2_2', width: 140, title: '有效期2_2' },
                    {
                        field: 'postponedMaterial2_2',
                        width: 140,
                        title: '延期材料2_2',
                        templet: function (row) {
                            var result = "";

                            if (row.postponedMaterial2_2 == 10) {
                                result = "是"
                            } else if (row.postponedMaterial2_2 == 20) {
                                result = "否"
                            }

                            return result;
                        },
                        align: 'center'
                    },


                    { field: 'bookBuildupStructure', width: 120, title: '满本结构' },
                    { field: 'plateNum', width: 100, title: '垫厚钢板数', align: 'center', totalRow: true },
                    { field: 'panelQuan', width: 100, title: '板数', align: 'center', totalRow: true  },
                    { field: 'secionQuan', width: 120, title: '含切片的板数', align: 'center' },
                    { field: 'alphaBoardStayTime', width: 120, title: '棕化停留时间' },

                    { field: 'stopperQualityString', width: 100, title: '防滑质量' },
                    { field: 'perpregSurfaceQualityString', width: 100, title: '表面质量' },
                    { field: 'pcsKraftQualityString', width: 140, title: '14张牛皮纸数量' },
                    { field: 'innerCoreQualityString', width: 140, title: '内层芯板质量' },
                    { field: 'copperFoilQualityString', width: 100, title: '铜箔质量' }, 
                    { field: 'containerCode', width: 100, title: '底板编码' },
                    { field: 'watchmanMachineCode', width: 100, title: '拆板设备' },
                    { field: 'watchmanDate', width: 170, title: '拆板时间' },
                    { field: 'watchmanBy', width: 100, title: '拆板人' },
                    { field: 'remark', width: 100, title: '备注' },
                    {
                        field: 'useStatus',
                        width: 100,
                        title: '使用状态',
                        templet: function (row) {
                            var result = "";

                            if (row.useStatus == 0) {
                                result = "未使用"
                            } else if (row.useStatus == 1) {
                                result = "已使用"
                            }

                            return result;
                        },
                        align: 'center'
                    },
                    { field: 'createdDate', width: 170, title: '创建时间' },
                ]]
            });
            //监听行工具事件
            table.on('tool(test)', function (obj) { //注：tool 是工具条事件名，test 是 table 原始容器的属性 lay-filter="对应的值"
                //行数据
                var data = obj.data;

                if (obj.event === 'del') {

                    var data = {
                        id: data.id
                    };

                    Topro.UI.Confirm({
                        content: '您确认要删除吗.',
                        ok: function () {

                            Topro.Util.Ajax({
                                type: "POST",
                                url: "/iqs/UpdateStatus",
                                data: data,
                                success: function (res) {
                                    if (res.success) {

                                        doSearch();

                                        Topro.UI.Tip_short_success("操作成功！");
                                    } else {
                                        Topro.UI.Tip_short_warning("操作失败！" + res.message);
                                    }
                                },
                                error: function (json) {
                                    Topro.UI.Tip_warning("操作失败！请查看网络，请重试。");
                                }
                            });

                        }
                    });
                } else if (obj.event === 'edit') {

                    edit(data.id);

                    return;
                    //接受输入的信息
                    var staffNum = prompt("请输入正确的员工号:", "");

                    if (!Topro.Util.isNullOrEmptySpance(staffNum)) {

                        var data = {
                            id: data.id,
                            staffNum: staffNum
                        };

                        Topro.Util.Ajax({
                            type: "POST",
                            url: "/iqs/UpdateStaffNum",
                            data: data,
                            success: function (res) {
                                if (res.success) {

                                    doSearch();

                                    Topro.UI.Tip_short_success("操作成功！");
                                } else {
                                    Topro.UI.Tip_short_warning("操作失败！" + res.message);
                                }
                            },
                            error: function (json) {
                                Topro.UI.Tip_warning("操作失败！请查看网络，请重试。");
                            }
                        });
                    }
                }
            });
        });

    </script>
}


